package com.xsp.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author xsp
 * @date 2024/1/9
 * @desc
 */
@Data
// 等于<bean id = "cat" class = "com.xsp.entity.Cat"/>
@Component(value = "cat")
public class Cat {
    public Cat(String name, String type) {
        this.name = name;
        this.type = type;
    }

    public Cat() {
    }

    @Value(value="${cat.name}")
    private String name;
    @Value(value="${cat.type}")
    private String type;

    public void miaow() {
        System.out.println(this.name + ":喵喵喵");
    }

    public void purr() {
        System.out.println(this.name + ":咕噜咕噜。。。。。");
    }
}
